#version 100

precision mediump float;

#include <flutter/runtime_effect.glsl>

uniform vec2 iResolution;
uniform float iTime;

out vec4 fragColor;

#define t iTime
#define r iResolution.xy

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec3 c;
    float l, z = t;
    for (int i = 0;i < 3; i++) {
        vec2 uv, p = fragCoord.xy / r;
        uv = p;
        p -= .5;
        p.x *= r.x / r.y;
        z += .07;
        l = length(p);
        uv += p / l * (sin(z) + 1.) * abs(sin(l * 9. - z - z));
        c[i] = .01 / length(mod(uv, 1.) - .5);
    }
    fragColor = vec4(c / l, t);
}

void main() {
    vec2 coord = FlutterFragCoord().xy;
    mainImage(fragColor, coord);
}